package dipl.algorithm.math.primitive;

import dipl.algorithm.math.utility.ApfloatUtils;
import org.apfloat.Apfloat;

/**
  * point in 2d real space
 */
public class Point2d {

    //
    // CONSTRUCTOR METHODS
    //

    public Point2d() {
      x = ApfloatUtils._0;
      y = ApfloatUtils._0;
    }

    public Point2d( Apfloat x, Apfloat y ) {
      this.x = x;
      this.y = y;
    }

    public Point2d( Point2d other ) {
      x = other.x;
      y = other.y;
    }

    //
    // PUBLIC METHODS
    //

		/**
		 * Returns whether this point equals given point o
		 * @param o
		 * @return 
		 */
		public boolean Equals( Point2d o ) {
			return (x.compareTo( o.x ) == 0 && y.compareTo( o.y ) == 0);
		}
    /**
     * 
     * @param other
     */
    public void Set( Point2d other ) {
      x = other.x;
      y = other.y;
    }

    /**
     *
     * @param x
     * @param y
     */
    public void Set( Apfloat x, Apfloat y ) {
      this.x = x;
      this.y = y;
    }

    @Override
    public String toString() {
      return "[x:"+x.doubleValue()+", y:"+y.doubleValue()+"]";
    }


    //
    // MEMBERS
    //

    public Apfloat x;
    public Apfloat y;
  }
